#用户密码验证
# def length(p,g):
#     if len(p) > 8:
#         g += 1
#         return g
#     else:
#         print("此密码不符合要求，密码长度必须超过8位")
#         return 0
#
# def variety(p,g):
#     lst = list(p)
#     u = 0
#     l = 0
#     d = 0
#     o = 0
#     for i in lst:
#         if i.isupper():
#             u += 1
#         elif i.islower():
#             l += 1
#         elif i.isdigit():
#             d += 1
#         else:
#             o +=1
#     if u > 0 and l > 0 and d > 0 and o > 0:
#         g += 1
#         return g
#     elif u > 0 and l > 0 and d > 0 and o == 0:
#         g += 1
#         return g
#     elif u > 0 and l > 0 and d == 0 and o > 0:
#         g += 1
#         return g
#     elif u > 0 and l == 0 and d > 0 and o > 0:
#         g += 1
#         return g
#     elif u == 0 and l > 0 and d > 0 and o > 0:
#         g += 1
#         return g
#     else:
#         return 0
#
# def repetition(p,g):
#     lst = list(p)
#     i = 0
#     j = g
#     while i < len(lst)-4:
#         str = lst[i:i+3]
#         if str not in lst[i+3:]:
#             g += 1
#             break
#         i += 1
#     if g > j:
#         return g
#     else:
#         return 0
#
# passwd = input("请输入密码：")
# grade = 2
# advice = []
#
# if length(passwd,grade):
#     grade = length(passwd,grade)
# else:
#     advice.append("长度小于8")
#
# if variety(passwd,grade):
#     grade = variety(passwd,grade)
# else:
#     advice.append("密码没有由3种以上的字符组成")
#
# if repetition(passwd,grade):
#     grade = repetition(passwd,grade)
# else:
#     advice.append("有长度超过或等于3的子串重复")
#
# print(f"评分等级{grade}")
# if len(advice) > 0:
#     print(advice)



# #三创购物系统
# user_table = {"llf":"123456","LLF":"234567"}
# goods_name = {'001':'西瓜','002':'香蕉','003':'苹果','004':'橘子'}
# #商品对应的编号
# goods_price = {'001':8,'002':9,'003':10,'004':12}
# #编号对应的价格
# buy = {}
#
# def log_test(name,passwd):
#     user = (name,passwd)
#     if user in user_table.items():
#         return True
#     else:
#         return False
#
# def shopping_system(budget):
#     while True:
#         num = input("查看商品信息请输入1,查看已购买信息请输入2,购买商品请输入3:")
#         if num == "1":
#             for i,j in goods_name.items():
#                 print(f"编号{i},商品是{j},价格是{goods_price[i]}")
#         elif num == "2":
#             for i,j in buy.items():
#                 print(f"购买了{i},花费了{j}元")
#         elif num == "exit":
#             for i in buy:
#                 print(f"已购买商品{i},余额{budget}")
#             break
#         elif num == "3":
#             num1 = input("请输入购买商品的编号：")
#             if num1 in goods_price:
#                 if budget >= goods_price[num1]:
#                     budget -= goods_price[num1]
#                     buy[goods_name[num1]] = goods_price[num1]
#                 else:
#                     print("余额不足，请充值")
#             elif num1 == "exit":
#                 for i in buy:
#                     print(f"已购买商品{i},余额{budget}")
#                 break
#             else:
#                 print("输入的编号有误")
#         else:
#             print("输入编号有误，请重新输入")
#
# while True:
#     print("退出请输入exit")
#     name = input("请输入用户名：")
#     passwd = input("请输入密码：")
#     if log_test(name,passwd):
#         print("欢迎进入三创购物系统")
#         while True:
#             budget = input("请输入你的预算(必须是整数):")
#             if budget.isdigit():
#                 shopping_system(int(budget))
#                 prompt = "exit"
#                 break
#             elif budget == "exit":
#                 break
#             else:
#                 print("输入的预算有错误，请重新输入")
#     elif name == "exit" or passwd == "exit":
#         print("退出登陆系统")
#         break
#     else:
#         print("用户名密码输入错误，请重新输入")
#
#     if budget == "exit":
#         print("已退出三创购物系统")
#         break
#
#     if budget == "exit":
#         print("已退出三创购物系统")
#         break











